<template>
    <div class="root">
        <Headers></Headers>
        <blur :blur-amount="20" :url="zhu.background_img_url" height="350">
            <div class="center">
                <img class="photo" :src="zhu.avatar" />
                <h2> {{zhu.username}}</h2>
                <p> ★</p>
                <button> 关注</button>
            </div>
            <div class="cen-2">
                <p class="c-1"> {{zhu.blog_count}}
                    <br/> 收集</p>
                <p class="c-1"> {{zhu.album_like_count}}
                    <br/> 喜欢</p>
                <p class="c-1"> {{zhu.article_count}}
                    <br/> 关注</p>
                <p class="c-1"> {{zhu.be_follow_count}}
                    <br/> 粉丝</p>
            </div>
        </blur>
        <!--列表-->
        <div class="lie">
            <div class="lie-1" v-for="l in liebiao">
                <img :src="l.covers" />
                <div class="jianjie">
                    <p> {{l.name}} </p>
                    <span> {{l.count}} 收集 {{l.like_count}} 喜欢</span>
                </div>
            </div>
        </div>
        <!--底部foot是否出现-->
        <div class="foo-tabbar" v-if="Fooxian">
            <Foot> </Foot>
        </div>
        <h1> </h1>
    
    </div>
</template>

<script>
import Headers from '../components/Headers.vue'
import { Blur } from 'vux'
import Foot from '../components/Foot.vue'
export default {
    components: {
        Blur,
        Headers,
        Foot
    },
    data: function () {
        return {
            zhu: {},
            liebiao: [],
            Fooxian: false
        }
    },
    activated: function () {
        this.$el.scrollTop = this.currentOffset;
    },
    mounted() {
        this.requestProfile()
        this.requestLit()
        //  底部下面提示栏
        this.$el.onscroll = function (e) {
            //滚动偏移量
            var offset = e.target.scrollTop;
            this.currentOffset = offset;
            if (offset >100) {
                this.Fooxian = true;
            }
            else {
                this.Fooxian = false;
            }
        }.bind(this);

    },
    methods: {
        requestProfile() {
            this.$http.get("dt/napi/people/profile/?", {
                params: {
                    user_id: this.$route.params.id
                }
            })
                .then(function (res) {
                    // console.dir(res.data.data)
                    this.zhu = res.data.data
                }.bind(this))
        },
        requestLit() {
            this.$http.get("dt/napi/album/list/by_user/?", {
                params: {
                    start: 0,
                    limit: 24,
                    user_id: this.$route.params.id,
                    _: 1497592109476
                }
            })
                .then(function (res) {
                    console.dir(res.data.data.object_list)
                    this.liebiao = res.data.data.object_list
                }.bind(this))
        }
    }

}
</script>

<style scoped>
.photo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
}

button {
    background-color: #49CD76;
    color: white;
    width: 80px;
    height: 40px;
    border-radius: 5px;
}

.center {
    text-align: center;
    padding-top: 50px;
    color: #fff;
}

.cen-2 {
    margin-top: 35px;
    display: flex;
    justify-content: space-around;
}

.c-1 {
    text-align: center;
    color: white;
    font-size: 14px;
}

.lie {
    background-color: #F5F5F5;
    display: flex;
    flex-wrap: wrap;
}

.lie-1 {
    width: 160px;
    border: 0.5px solid #E0E0E0;
    margin: 15px auto;
    background-color: white;
}

.lie-1 img {
    width: 160px;
    height: 160px;
}

.jianjie {
    padding: 0px 0px 10px 10px;
}

.jianjie p {
    padding: 0;
    margin: 0;
    overflow: hidden;
    max-height: 32px;
    color: #333;
    line-height: 16px;
    font-size: 13px;
    font-weight: 700;
}

.jianjie span {
    font-size: 12px;
    color: #999999;
}

.foo-tabbar {
    position: fixed;
    bottom: 0px;
}
</style>
